package leesoft.toolbox.export.templates;

import java.util.ArrayList;
import java.util.List;

import com.sisuntech.db.DbUtil;

public class Application implements IDBValueTemplate {
	String query;

	public void setQuery(String query) {
		String sql="select aid,c.name as name,'女' as sex,birth,contact,u.name as unit_name,CONVERT(varchar(100), create_dt, 23) as create_dt from "+
		"tap_application as c left outer join tap_unit as u on c.unit=u.id ";
		try{
			this.query=sql+new String(query.getBytes( "ISO8859_1"), "gb2312");
		}catch(Exception e){
			this.query=sql+query;
		}
		//System.out.println(this.query);
	}

	
	public List<Field> getFields() {
		FieldsListGenerator fg=new FieldsListGenerator();
		return fg.add("aid", "条形码编号").add("name", "姓名").add("sex", "性别")
		.add("birth", "年龄")
		.add("contact", "联系电话").add("unit_name", "采集单位").add("create_dt", "送检日期").getFieldList();
		
	}


	public List getValues() {
		List result=DbUtil.getValueBase(query);
		return result;
	}

}